{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1 利用 pandas 读取 sh.600000.csv 文件中的数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.read_csv('sh.600000.csv')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2 查看前 5 行数据与后 5 行数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>code</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>preclose</th>\n",
       "      <th>volume</th>\n",
       "      <th>amount</th>\n",
       "      <th>adjustflag</th>\n",
       "      <th>turn</th>\n",
       "      <th>tradestatus</th>\n",
       "      <th>pctChg</th>\n",
       "      <th>peTTM</th>\n",
       "      <th>pbMRQ</th>\n",
       "      <th>psTTM</th>\n",
       "      <th>pcfNcfTTM</th>\n",
       "      <th>isST</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2017-12-07</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.814685</td>\n",
       "      <td>12.893850</td>\n",
       "      <td>12.775103</td>\n",
       "      <td>12.824581</td>\n",
       "      <td>12.824581</td>\n",
       "      <td>34802229</td>\n",
       "      <td>451233524.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.123835</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>7.004418</td>\n",
       "      <td>0.981842</td>\n",
       "      <td>2.310626</td>\n",
       "      <td>-2.043354</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2017-12-08</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.844372</td>\n",
       "      <td>12.854267</td>\n",
       "      <td>12.735521</td>\n",
       "      <td>12.794894</td>\n",
       "      <td>12.824581</td>\n",
       "      <td>31296221</td>\n",
       "      <td>404411517.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.111360</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.231479</td>\n",
       "      <td>6.988205</td>\n",
       "      <td>0.979569</td>\n",
       "      <td>2.305277</td>\n",
       "      <td>-2.038624</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2017-12-11</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.784999</td>\n",
       "      <td>12.903745</td>\n",
       "      <td>12.715730</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.794894</td>\n",
       "      <td>36649902</td>\n",
       "      <td>474566888.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.130409</td>\n",
       "      <td>1</td>\n",
       "      <td>0.309358</td>\n",
       "      <td>7.009823</td>\n",
       "      <td>0.982600</td>\n",
       "      <td>2.312409</td>\n",
       "      <td>-2.044930</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2017-12-12</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.606880</td>\n",
       "      <td>12.616775</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>30370097</td>\n",
       "      <td>390113096.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.108064</td>\n",
       "      <td>1</td>\n",
       "      <td>-1.696224</td>\n",
       "      <td>6.890921</td>\n",
       "      <td>0.965933</td>\n",
       "      <td>2.273185</td>\n",
       "      <td>-2.010244</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2017-12-13</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.666253</td>\n",
       "      <td>12.676148</td>\n",
       "      <td>12.498029</td>\n",
       "      <td>12.606880</td>\n",
       "      <td>12.616775</td>\n",
       "      <td>19345338</td>\n",
       "      <td>246331123.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.068835</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.078433</td>\n",
       "      <td>6.885516</td>\n",
       "      <td>0.965175</td>\n",
       "      <td>2.271402</td>\n",
       "      <td>-2.008667</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         date       code       open       high        low      close  \\\n",
       "0  2017-12-07  sh.600000  12.814685  12.893850  12.775103  12.824581   \n",
       "1  2017-12-08  sh.600000  12.844372  12.854267  12.735521  12.794894   \n",
       "2  2017-12-11  sh.600000  12.784999  12.903745  12.715730  12.834476   \n",
       "3  2017-12-12  sh.600000  12.834476  12.834476  12.606880  12.616775   \n",
       "4  2017-12-13  sh.600000  12.666253  12.676148  12.498029  12.606880   \n",
       "\n",
       "    preclose    volume       amount  adjustflag      turn  tradestatus  \\\n",
       "0  12.824581  34802229  451233524.0           2  0.123835            1   \n",
       "1  12.824581  31296221  404411517.0           2  0.111360            1   \n",
       "2  12.794894  36649902  474566888.0           2  0.130409            1   \n",
       "3  12.834476  30370097  390113096.0           2  0.108064            1   \n",
       "4  12.616775  19345338  246331123.0           2  0.068835            1   \n",
       "\n",
       "     pctChg     peTTM     pbMRQ     psTTM  pcfNcfTTM  isST  \n",
       "0  0.000000  7.004418  0.981842  2.310626  -2.043354     0  \n",
       "1 -0.231479  6.988205  0.979569  2.305277  -2.038624     0  \n",
       "2  0.309358  7.009823  0.982600  2.312409  -2.044930     0  \n",
       "3 -1.696224  6.890921  0.965933  2.273185  -2.010244     0  \n",
       "4 -0.078433  6.885516  0.965175  2.271402  -2.008667     0  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>code</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>preclose</th>\n",
       "      <th>volume</th>\n",
       "      <th>amount</th>\n",
       "      <th>adjustflag</th>\n",
       "      <th>turn</th>\n",
       "      <th>tradestatus</th>\n",
       "      <th>pctChg</th>\n",
       "      <th>peTTM</th>\n",
       "      <th>pbMRQ</th>\n",
       "      <th>psTTM</th>\n",
       "      <th>pcfNcfTTM</th>\n",
       "      <th>isST</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>240</th>\n",
       "      <td>2018-12-03</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>10.99</td>\n",
       "      <td>11.05</td>\n",
       "      <td>10.84</td>\n",
       "      <td>11.02</td>\n",
       "      <td>10.71</td>\n",
       "      <td>43049070</td>\n",
       "      <td>472438382.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.153179</td>\n",
       "      <td>1</td>\n",
       "      <td>2.894495</td>\n",
       "      <td>5.820451</td>\n",
       "      <td>0.760281</td>\n",
       "      <td>1.899833</td>\n",
       "      <td>3.113035</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>241</th>\n",
       "      <td>2018-12-04</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>11.00</td>\n",
       "      <td>11.08</td>\n",
       "      <td>10.97</td>\n",
       "      <td>11.08</td>\n",
       "      <td>11.02</td>\n",
       "      <td>20811293</td>\n",
       "      <td>229713745.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.074052</td>\n",
       "      <td>1</td>\n",
       "      <td>0.544460</td>\n",
       "      <td>5.852141</td>\n",
       "      <td>0.764420</td>\n",
       "      <td>1.910177</td>\n",
       "      <td>3.129985</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>242</th>\n",
       "      <td>2018-12-05</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>10.99</td>\n",
       "      <td>11.10</td>\n",
       "      <td>10.96</td>\n",
       "      <td>11.00</td>\n",
       "      <td>11.08</td>\n",
       "      <td>25491217</td>\n",
       "      <td>281189602.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.090704</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.722021</td>\n",
       "      <td>5.809888</td>\n",
       "      <td>0.758901</td>\n",
       "      <td>1.896385</td>\n",
       "      <td>3.107385</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>243</th>\n",
       "      <td>2018-12-06</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>10.82</td>\n",
       "      <td>10.93</td>\n",
       "      <td>10.82</td>\n",
       "      <td>10.90</td>\n",
       "      <td>11.00</td>\n",
       "      <td>23597997</td>\n",
       "      <td>256533148.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.083967</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.909094</td>\n",
       "      <td>5.757070</td>\n",
       "      <td>0.752002</td>\n",
       "      <td>1.879146</td>\n",
       "      <td>3.079136</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>244</th>\n",
       "      <td>2018-12-07</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>10.94</td>\n",
       "      <td>11.03</td>\n",
       "      <td>10.88</td>\n",
       "      <td>10.89</td>\n",
       "      <td>10.90</td>\n",
       "      <td>10580550</td>\n",
       "      <td>115760323.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.037648</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.091736</td>\n",
       "      <td>5.751789</td>\n",
       "      <td>0.751312</td>\n",
       "      <td>1.877422</td>\n",
       "      <td>3.076312</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           date       code   open   high    low  close  preclose    volume  \\\n",
       "240  2018-12-03  sh.600000  10.99  11.05  10.84  11.02     10.71  43049070   \n",
       "241  2018-12-04  sh.600000  11.00  11.08  10.97  11.08     11.02  20811293   \n",
       "242  2018-12-05  sh.600000  10.99  11.10  10.96  11.00     11.08  25491217   \n",
       "243  2018-12-06  sh.600000  10.82  10.93  10.82  10.90     11.00  23597997   \n",
       "244  2018-12-07  sh.600000  10.94  11.03  10.88  10.89     10.90  10580550   \n",
       "\n",
       "          amount  adjustflag      turn  tradestatus    pctChg     peTTM  \\\n",
       "240  472438382.0           2  0.153179            1  2.894495  5.820451   \n",
       "241  229713745.0           2  0.074052            1  0.544460  5.852141   \n",
       "242  281189602.0           2  0.090704            1 -0.722021  5.809888   \n",
       "243  256533148.0           2  0.083967            1 -0.909094  5.757070   \n",
       "244  115760323.0           2  0.037648            1 -0.091736  5.751789   \n",
       "\n",
       "        pbMRQ     psTTM  pcfNcfTTM  isST  \n",
       "240  0.760281  1.899833   3.113035     0  \n",
       "241  0.764420  1.910177   3.129985     0  \n",
       "242  0.758901  1.896385   3.107385     0  \n",
       "243  0.752002  1.879146   3.079136     0  \n",
       "244  0.751312  1.877422   3.076312     0  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.tail()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3 查看该份数据的描述统计"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>preclose</th>\n",
       "      <th>volume</th>\n",
       "      <th>amount</th>\n",
       "      <th>adjustflag</th>\n",
       "      <th>turn</th>\n",
       "      <th>tradestatus</th>\n",
       "      <th>pctChg</th>\n",
       "      <th>peTTM</th>\n",
       "      <th>pbMRQ</th>\n",
       "      <th>psTTM</th>\n",
       "      <th>pcfNcfTTM</th>\n",
       "      <th>isST</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>245.000000</td>\n",
       "      <td>245.000000</td>\n",
       "      <td>245.000000</td>\n",
       "      <td>245.000000</td>\n",
       "      <td>245.000000</td>\n",
       "      <td>2.450000e+02</td>\n",
       "      <td>2.450000e+02</td>\n",
       "      <td>245.0</td>\n",
       "      <td>245.000000</td>\n",
       "      <td>245.0</td>\n",
       "      <td>245.000000</td>\n",
       "      <td>245.000000</td>\n",
       "      <td>245.000000</td>\n",
       "      <td>245.000000</td>\n",
       "      <td>245.000000</td>\n",
       "      <td>245.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>11.095712</td>\n",
       "      <td>11.189029</td>\n",
       "      <td>10.992367</td>\n",
       "      <td>11.084785</td>\n",
       "      <td>11.092682</td>\n",
       "      <td>3.582759e+07</td>\n",
       "      <td>4.270868e+08</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.127483</td>\n",
       "      <td>1.0</td>\n",
       "      <td>-0.083437</td>\n",
       "      <td>6.019194</td>\n",
       "      <td>0.822677</td>\n",
       "      <td>1.960009</td>\n",
       "      <td>8.323278</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>1.132764</td>\n",
       "      <td>1.144871</td>\n",
       "      <td>1.125110</td>\n",
       "      <td>1.136245</td>\n",
       "      <td>1.141595</td>\n",
       "      <td>4.524912e+07</td>\n",
       "      <td>6.108954e+08</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.161007</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.392350</td>\n",
       "      <td>0.643421</td>\n",
       "      <td>0.104405</td>\n",
       "      <td>0.200529</td>\n",
       "      <td>10.900488</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>9.163242</td>\n",
       "      <td>9.252302</td>\n",
       "      <td>9.074183</td>\n",
       "      <td>9.163242</td>\n",
       "      <td>9.163242</td>\n",
       "      <td>8.995716e+06</td>\n",
       "      <td>9.169444e+07</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.032009</td>\n",
       "      <td>1.0</td>\n",
       "      <td>-5.391040</td>\n",
       "      <td>5.023942</td>\n",
       "      <td>0.682401</td>\n",
       "      <td>1.644255</td>\n",
       "      <td>-2.152143</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>10.170000</td>\n",
       "      <td>10.270000</td>\n",
       "      <td>10.100000</td>\n",
       "      <td>10.170000</td>\n",
       "      <td>10.170000</td>\n",
       "      <td>1.755753e+07</td>\n",
       "      <td>1.882069e+08</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.062474</td>\n",
       "      <td>1.0</td>\n",
       "      <td>-0.771871</td>\n",
       "      <td>5.495953</td>\n",
       "      <td>0.735460</td>\n",
       "      <td>1.798737</td>\n",
       "      <td>-1.958214</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>10.815792</td>\n",
       "      <td>10.885061</td>\n",
       "      <td>10.700000</td>\n",
       "      <td>10.786106</td>\n",
       "      <td>10.786106</td>\n",
       "      <td>2.294848e+07</td>\n",
       "      <td>2.417497e+08</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.081656</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>5.810628</td>\n",
       "      <td>0.774275</td>\n",
       "      <td>1.899833</td>\n",
       "      <td>10.895982</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>12.280328</td>\n",
       "      <td>12.349596</td>\n",
       "      <td>12.230850</td>\n",
       "      <td>12.290223</td>\n",
       "      <td>12.329805</td>\n",
       "      <td>3.148443e+07</td>\n",
       "      <td>3.724712e+08</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.112029</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.631583</td>\n",
       "      <td>6.721107</td>\n",
       "      <td>0.940932</td>\n",
       "      <td>2.161991</td>\n",
       "      <td>12.496256</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>13.507371</td>\n",
       "      <td>13.853714</td>\n",
       "      <td>13.220401</td>\n",
       "      <td>13.507371</td>\n",
       "      <td>13.507371</td>\n",
       "      <td>3.796536e+08</td>\n",
       "      <td>5.099364e+09</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.350900</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.193799</td>\n",
       "      <td>7.386724</td>\n",
       "      <td>1.034116</td>\n",
       "      <td>2.376102</td>\n",
       "      <td>31.326051</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             open        high         low       close    preclose  \\\n",
       "count  245.000000  245.000000  245.000000  245.000000  245.000000   \n",
       "mean    11.095712   11.189029   10.992367   11.084785   11.092682   \n",
       "std      1.132764    1.144871    1.125110    1.136245    1.141595   \n",
       "min      9.163242    9.252302    9.074183    9.163242    9.163242   \n",
       "25%     10.170000   10.270000   10.100000   10.170000   10.170000   \n",
       "50%     10.815792   10.885061   10.700000   10.786106   10.786106   \n",
       "75%     12.280328   12.349596   12.230850   12.290223   12.329805   \n",
       "max     13.507371   13.853714   13.220401   13.507371   13.507371   \n",
       "\n",
       "             volume        amount  adjustflag        turn  tradestatus  \\\n",
       "count  2.450000e+02  2.450000e+02       245.0  245.000000        245.0   \n",
       "mean   3.582759e+07  4.270868e+08         2.0    0.127483          1.0   \n",
       "std    4.524912e+07  6.108954e+08         0.0    0.161007          0.0   \n",
       "min    8.995716e+06  9.169444e+07         2.0    0.032009          1.0   \n",
       "25%    1.755753e+07  1.882069e+08         2.0    0.062474          1.0   \n",
       "50%    2.294848e+07  2.417497e+08         2.0    0.081656          1.0   \n",
       "75%    3.148443e+07  3.724712e+08         2.0    0.112029          1.0   \n",
       "max    3.796536e+08  5.099364e+09         2.0    1.350900          1.0   \n",
       "\n",
       "           pctChg       peTTM       pbMRQ       psTTM   pcfNcfTTM   isST  \n",
       "count  245.000000  245.000000  245.000000  245.000000  245.000000  245.0  \n",
       "mean    -0.083437    6.019194    0.822677    1.960009    8.323278    0.0  \n",
       "std      1.392350    0.643421    0.104405    0.200529   10.900488    0.0  \n",
       "min     -5.391040    5.023942    0.682401    1.644255   -2.152143    0.0  \n",
       "25%     -0.771871    5.495953    0.735460    1.798737   -1.958214    0.0  \n",
       "50%      0.000000    5.810628    0.774275    1.899833   10.895982    0.0  \n",
       "75%      0.631583    6.721107    0.940932    2.161991   12.496256    0.0  \n",
       "max      5.193799    7.386724    1.034116    2.376102   31.326051    0.0  "
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.describe()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4 查看该份数据的字段概况"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 245 entries, 0 to 244\n",
      "Data columns (total 18 columns):\n",
      " #   Column       Non-Null Count  Dtype  \n",
      "---  ------       --------------  -----  \n",
      " 0   date         245 non-null    object \n",
      " 1   code         245 non-null    object \n",
      " 2   open         245 non-null    float64\n",
      " 3   high         245 non-null    float64\n",
      " 4   low          245 non-null    float64\n",
      " 5   close        245 non-null    float64\n",
      " 6   preclose     245 non-null    float64\n",
      " 7   volume       245 non-null    int64  \n",
      " 8   amount       245 non-null    float64\n",
      " 9   adjustflag   245 non-null    int64  \n",
      " 10  turn         245 non-null    float64\n",
      " 11  tradestatus  245 non-null    int64  \n",
      " 12  pctChg       245 non-null    float64\n",
      " 13  peTTM        245 non-null    float64\n",
      " 14  pbMRQ        245 non-null    float64\n",
      " 15  psTTM        245 non-null    float64\n",
      " 16  pcfNcfTTM    245 non-null    float64\n",
      " 17  isST         245 non-null    int64  \n",
      "dtypes: float64(12), int64(4), object(2)\n",
      "memory usage: 34.6+ KB\n"
     ]
    }
   ],
   "source": [
    "data.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5 数据的选取"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### (1) 使用 [ ] 位置索引方式，选取出前 3 行数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>code</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>preclose</th>\n",
       "      <th>volume</th>\n",
       "      <th>amount</th>\n",
       "      <th>adjustflag</th>\n",
       "      <th>turn</th>\n",
       "      <th>tradestatus</th>\n",
       "      <th>pctChg</th>\n",
       "      <th>peTTM</th>\n",
       "      <th>pbMRQ</th>\n",
       "      <th>psTTM</th>\n",
       "      <th>pcfNcfTTM</th>\n",
       "      <th>isST</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2017-12-07</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.814685</td>\n",
       "      <td>12.893850</td>\n",
       "      <td>12.775103</td>\n",
       "      <td>12.824581</td>\n",
       "      <td>12.824581</td>\n",
       "      <td>34802229</td>\n",
       "      <td>451233524.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.123835</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>7.004418</td>\n",
       "      <td>0.981842</td>\n",
       "      <td>2.310626</td>\n",
       "      <td>-2.043354</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2017-12-08</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.844372</td>\n",
       "      <td>12.854267</td>\n",
       "      <td>12.735521</td>\n",
       "      <td>12.794894</td>\n",
       "      <td>12.824581</td>\n",
       "      <td>31296221</td>\n",
       "      <td>404411517.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.111360</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.231479</td>\n",
       "      <td>6.988205</td>\n",
       "      <td>0.979569</td>\n",
       "      <td>2.305277</td>\n",
       "      <td>-2.038624</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2017-12-11</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.784999</td>\n",
       "      <td>12.903745</td>\n",
       "      <td>12.715730</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.794894</td>\n",
       "      <td>36649902</td>\n",
       "      <td>474566888.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.130409</td>\n",
       "      <td>1</td>\n",
       "      <td>0.309358</td>\n",
       "      <td>7.009823</td>\n",
       "      <td>0.982600</td>\n",
       "      <td>2.312409</td>\n",
       "      <td>-2.044930</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         date       code       open       high        low      close  \\\n",
       "0  2017-12-07  sh.600000  12.814685  12.893850  12.775103  12.824581   \n",
       "1  2017-12-08  sh.600000  12.844372  12.854267  12.735521  12.794894   \n",
       "2  2017-12-11  sh.600000  12.784999  12.903745  12.715730  12.834476   \n",
       "\n",
       "    preclose    volume       amount  adjustflag      turn  tradestatus  \\\n",
       "0  12.824581  34802229  451233524.0           2  0.123835            1   \n",
       "1  12.824581  31296221  404411517.0           2  0.111360            1   \n",
       "2  12.794894  36649902  474566888.0           2  0.130409            1   \n",
       "\n",
       "     pctChg     peTTM     pbMRQ     psTTM  pcfNcfTTM  isST  \n",
       "0  0.000000  7.004418  0.981842  2.310626  -2.043354     0  \n",
       "1 -0.231479  6.988205  0.979569  2.305277  -2.038624     0  \n",
       "2  0.309358  7.009823  0.982600  2.312409  -2.044930     0  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[0:3]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### (2) 使用 [ ] 标签索引方式，选取出 “date” 一列，并用 type 查看返回的数据类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0      2017-12-07\n",
       "1      2017-12-08\n",
       "2      2017-12-11\n",
       "3      2017-12-12\n",
       "4      2017-12-13\n",
       "          ...    \n",
       "240    2018-12-03\n",
       "241    2018-12-04\n",
       "242    2018-12-05\n",
       "243    2018-12-06\n",
       "244    2018-12-07\n",
       "Name: date, Length: 245, dtype: object"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['date']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pandas.core.series.Series"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(data['date'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### (3) 使用 [ ] 标签索引方式，取出 “date”、“open” 列和 “colse” 列，并用 type 查看返回的数据类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>open</th>\n",
       "      <th>close</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2017-12-07</td>\n",
       "      <td>12.814685</td>\n",
       "      <td>12.824581</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2017-12-08</td>\n",
       "      <td>12.844372</td>\n",
       "      <td>12.794894</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2017-12-11</td>\n",
       "      <td>12.784999</td>\n",
       "      <td>12.834476</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2017-12-12</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.616775</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2017-12-13</td>\n",
       "      <td>12.666253</td>\n",
       "      <td>12.606880</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>240</th>\n",
       "      <td>2018-12-03</td>\n",
       "      <td>10.990000</td>\n",
       "      <td>11.020000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>241</th>\n",
       "      <td>2018-12-04</td>\n",
       "      <td>11.000000</td>\n",
       "      <td>11.080000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>242</th>\n",
       "      <td>2018-12-05</td>\n",
       "      <td>10.990000</td>\n",
       "      <td>11.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>243</th>\n",
       "      <td>2018-12-06</td>\n",
       "      <td>10.820000</td>\n",
       "      <td>10.900000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>244</th>\n",
       "      <td>2018-12-07</td>\n",
       "      <td>10.940000</td>\n",
       "      <td>10.890000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>245 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           date       open      close\n",
       "0    2017-12-07  12.814685  12.824581\n",
       "1    2017-12-08  12.844372  12.794894\n",
       "2    2017-12-11  12.784999  12.834476\n",
       "3    2017-12-12  12.834476  12.616775\n",
       "4    2017-12-13  12.666253  12.606880\n",
       "..          ...        ...        ...\n",
       "240  2018-12-03  10.990000  11.020000\n",
       "241  2018-12-04  11.000000  11.080000\n",
       "242  2018-12-05  10.990000  11.000000\n",
       "243  2018-12-06  10.820000  10.900000\n",
       "244  2018-12-07  10.940000  10.890000\n",
       "\n",
       "[245 rows x 3 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[['date', 'open', 'close']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pandas.core.frame.DataFrame"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(data[['date', 'open', 'close']])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### (4) 使用 [ ] 标签索引方式，选取收盘价大于 11.08 的所有数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>code</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>preclose</th>\n",
       "      <th>volume</th>\n",
       "      <th>amount</th>\n",
       "      <th>adjustflag</th>\n",
       "      <th>turn</th>\n",
       "      <th>tradestatus</th>\n",
       "      <th>pctChg</th>\n",
       "      <th>peTTM</th>\n",
       "      <th>pbMRQ</th>\n",
       "      <th>psTTM</th>\n",
       "      <th>pcfNcfTTM</th>\n",
       "      <th>isST</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2017-12-07</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.814685</td>\n",
       "      <td>12.893850</td>\n",
       "      <td>12.775103</td>\n",
       "      <td>12.824581</td>\n",
       "      <td>12.824581</td>\n",
       "      <td>34802229</td>\n",
       "      <td>451233524.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.123835</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>7.004418</td>\n",
       "      <td>0.981842</td>\n",
       "      <td>2.310626</td>\n",
       "      <td>-2.043354</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2017-12-08</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.844372</td>\n",
       "      <td>12.854267</td>\n",
       "      <td>12.735521</td>\n",
       "      <td>12.794894</td>\n",
       "      <td>12.824581</td>\n",
       "      <td>31296221</td>\n",
       "      <td>404411517.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.111360</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.231479</td>\n",
       "      <td>6.988205</td>\n",
       "      <td>0.979569</td>\n",
       "      <td>2.305277</td>\n",
       "      <td>-2.038624</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2017-12-11</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.784999</td>\n",
       "      <td>12.903745</td>\n",
       "      <td>12.715730</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.794894</td>\n",
       "      <td>36649902</td>\n",
       "      <td>474566888.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.130409</td>\n",
       "      <td>1</td>\n",
       "      <td>0.309358</td>\n",
       "      <td>7.009823</td>\n",
       "      <td>0.982600</td>\n",
       "      <td>2.312409</td>\n",
       "      <td>-2.044930</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2017-12-12</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.606880</td>\n",
       "      <td>12.616775</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>30370097</td>\n",
       "      <td>390113096.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.108064</td>\n",
       "      <td>1</td>\n",
       "      <td>-1.696224</td>\n",
       "      <td>6.890921</td>\n",
       "      <td>0.965933</td>\n",
       "      <td>2.273185</td>\n",
       "      <td>-2.010244</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2017-12-13</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.666253</td>\n",
       "      <td>12.676148</td>\n",
       "      <td>12.498029</td>\n",
       "      <td>12.606880</td>\n",
       "      <td>12.616775</td>\n",
       "      <td>19345338</td>\n",
       "      <td>246331123.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.068835</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.078433</td>\n",
       "      <td>6.885516</td>\n",
       "      <td>0.965175</td>\n",
       "      <td>2.271402</td>\n",
       "      <td>-2.008667</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>2018-04-25</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>11.587642</td>\n",
       "      <td>11.647015</td>\n",
       "      <td>11.528269</td>\n",
       "      <td>11.538165</td>\n",
       "      <td>11.656911</td>\n",
       "      <td>16082634</td>\n",
       "      <td>188149247.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.057226</td>\n",
       "      <td>1</td>\n",
       "      <td>-1.018675</td>\n",
       "      <td>6.309831</td>\n",
       "      <td>0.883355</td>\n",
       "      <td>2.029696</td>\n",
       "      <td>-1.838388</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>2018-04-26</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>11.607433</td>\n",
       "      <td>11.656911</td>\n",
       "      <td>11.429314</td>\n",
       "      <td>11.449105</td>\n",
       "      <td>11.538165</td>\n",
       "      <td>18205794</td>\n",
       "      <td>211987526.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.064781</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.771871</td>\n",
       "      <td>6.261128</td>\n",
       "      <td>0.876537</td>\n",
       "      <td>2.014029</td>\n",
       "      <td>-1.824198</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>93</th>\n",
       "      <td>2018-04-27</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>11.459001</td>\n",
       "      <td>11.548060</td>\n",
       "      <td>11.429314</td>\n",
       "      <td>11.488687</td>\n",
       "      <td>11.449105</td>\n",
       "      <td>23450783</td>\n",
       "      <td>272328553.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.083444</td>\n",
       "      <td>1</td>\n",
       "      <td>0.345721</td>\n",
       "      <td>6.282774</td>\n",
       "      <td>0.879567</td>\n",
       "      <td>2.020992</td>\n",
       "      <td>-1.830504</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>219</th>\n",
       "      <td>2018-11-02</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>11.100000</td>\n",
       "      <td>11.250000</td>\n",
       "      <td>10.940000</td>\n",
       "      <td>11.180000</td>\n",
       "      <td>10.890000</td>\n",
       "      <td>47788920</td>\n",
       "      <td>530913675.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.170045</td>\n",
       "      <td>1</td>\n",
       "      <td>2.662993</td>\n",
       "      <td>5.904959</td>\n",
       "      <td>0.771319</td>\n",
       "      <td>1.927417</td>\n",
       "      <td>3.158234</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>220</th>\n",
       "      <td>2018-11-05</td>\n",
       "      <td>sh.600000</td>\n",
       "      <td>11.150000</td>\n",
       "      <td>11.250000</td>\n",
       "      <td>11.080000</td>\n",
       "      <td>11.140000</td>\n",
       "      <td>11.180000</td>\n",
       "      <td>17012759</td>\n",
       "      <td>189481162.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.060536</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.357781</td>\n",
       "      <td>5.883832</td>\n",
       "      <td>0.768560</td>\n",
       "      <td>1.920521</td>\n",
       "      <td>3.146934</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>96 rows × 18 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           date       code       open       high        low      close  \\\n",
       "0    2017-12-07  sh.600000  12.814685  12.893850  12.775103  12.824581   \n",
       "1    2017-12-08  sh.600000  12.844372  12.854267  12.735521  12.794894   \n",
       "2    2017-12-11  sh.600000  12.784999  12.903745  12.715730  12.834476   \n",
       "3    2017-12-12  sh.600000  12.834476  12.834476  12.606880  12.616775   \n",
       "4    2017-12-13  sh.600000  12.666253  12.676148  12.498029  12.606880   \n",
       "..          ...        ...        ...        ...        ...        ...   \n",
       "91   2018-04-25  sh.600000  11.587642  11.647015  11.528269  11.538165   \n",
       "92   2018-04-26  sh.600000  11.607433  11.656911  11.429314  11.449105   \n",
       "93   2018-04-27  sh.600000  11.459001  11.548060  11.429314  11.488687   \n",
       "219  2018-11-02  sh.600000  11.100000  11.250000  10.940000  11.180000   \n",
       "220  2018-11-05  sh.600000  11.150000  11.250000  11.080000  11.140000   \n",
       "\n",
       "      preclose    volume       amount  adjustflag      turn  tradestatus  \\\n",
       "0    12.824581  34802229  451233524.0           2  0.123835            1   \n",
       "1    12.824581  31296221  404411517.0           2  0.111360            1   \n",
       "2    12.794894  36649902  474566888.0           2  0.130409            1   \n",
       "3    12.834476  30370097  390113096.0           2  0.108064            1   \n",
       "4    12.616775  19345338  246331123.0           2  0.068835            1   \n",
       "..         ...       ...          ...         ...       ...          ...   \n",
       "91   11.656911  16082634  188149247.0           2  0.057226            1   \n",
       "92   11.538165  18205794  211987526.0           2  0.064781            1   \n",
       "93   11.449105  23450783  272328553.0           2  0.083444            1   \n",
       "219  10.890000  47788920  530913675.0           2  0.170045            1   \n",
       "220  11.180000  17012759  189481162.0           2  0.060536            1   \n",
       "\n",
       "       pctChg     peTTM     pbMRQ     psTTM  pcfNcfTTM  isST  \n",
       "0    0.000000  7.004418  0.981842  2.310626  -2.043354     0  \n",
       "1   -0.231479  6.988205  0.979569  2.305277  -2.038624     0  \n",
       "2    0.309358  7.009823  0.982600  2.312409  -2.044930     0  \n",
       "3   -1.696224  6.890921  0.965933  2.273185  -2.010244     0  \n",
       "4   -0.078433  6.885516  0.965175  2.271402  -2.008667     0  \n",
       "..        ...       ...       ...       ...        ...   ...  \n",
       "91  -1.018675  6.309831  0.883355  2.029696  -1.838388     0  \n",
       "92  -0.771871  6.261128  0.876537  2.014029  -1.824198     0  \n",
       "93   0.345721  6.282774  0.879567  2.020992  -1.830504     0  \n",
       "219  2.662993  5.904959  0.771319  1.927417   3.158234     0  \n",
       "220 -0.357781  5.883832  0.768560  1.920521   3.146934     0  \n",
       "\n",
       "[96 rows x 18 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[data['close']>11.08]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### (5) 将 date 设置为索引，并重新命名数据库为 df1，使用 df.loc[] 标签定位方式，选取 df1 数据库中 2017-12-11 至 2017-12-20 的所有数据 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "df1 = data.set_index('date')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>code</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>preclose</th>\n",
       "      <th>volume</th>\n",
       "      <th>amount</th>\n",
       "      <th>adjustflag</th>\n",
       "      <th>turn</th>\n",
       "      <th>tradestatus</th>\n",
       "      <th>pctChg</th>\n",
       "      <th>peTTM</th>\n",
       "      <th>pbMRQ</th>\n",
       "      <th>psTTM</th>\n",
       "      <th>pcfNcfTTM</th>\n",
       "      <th>isST</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2017-12-07</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.814685</td>\n",
       "      <td>12.893850</td>\n",
       "      <td>12.775103</td>\n",
       "      <td>12.824581</td>\n",
       "      <td>12.824581</td>\n",
       "      <td>34802229</td>\n",
       "      <td>451233524.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.123835</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>7.004418</td>\n",
       "      <td>0.981842</td>\n",
       "      <td>2.310626</td>\n",
       "      <td>-2.043354</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-08</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.844372</td>\n",
       "      <td>12.854267</td>\n",
       "      <td>12.735521</td>\n",
       "      <td>12.794894</td>\n",
       "      <td>12.824581</td>\n",
       "      <td>31296221</td>\n",
       "      <td>404411517.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.111360</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.231479</td>\n",
       "      <td>6.988205</td>\n",
       "      <td>0.979569</td>\n",
       "      <td>2.305277</td>\n",
       "      <td>-2.038624</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-11</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.784999</td>\n",
       "      <td>12.903745</td>\n",
       "      <td>12.715730</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.794894</td>\n",
       "      <td>36649902</td>\n",
       "      <td>474566888.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.130409</td>\n",
       "      <td>1</td>\n",
       "      <td>0.309358</td>\n",
       "      <td>7.009823</td>\n",
       "      <td>0.982600</td>\n",
       "      <td>2.312409</td>\n",
       "      <td>-2.044930</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-12</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.606880</td>\n",
       "      <td>12.616775</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>30370097</td>\n",
       "      <td>390113096.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.108064</td>\n",
       "      <td>1</td>\n",
       "      <td>-1.696224</td>\n",
       "      <td>6.890921</td>\n",
       "      <td>0.965933</td>\n",
       "      <td>2.273185</td>\n",
       "      <td>-2.010244</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-13</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.666253</td>\n",
       "      <td>12.676148</td>\n",
       "      <td>12.498029</td>\n",
       "      <td>12.606880</td>\n",
       "      <td>12.616775</td>\n",
       "      <td>19345338</td>\n",
       "      <td>246331123.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.068835</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.078433</td>\n",
       "      <td>6.885516</td>\n",
       "      <td>0.965175</td>\n",
       "      <td>2.271402</td>\n",
       "      <td>-2.008667</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-12-03</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>10.990000</td>\n",
       "      <td>11.050000</td>\n",
       "      <td>10.840000</td>\n",
       "      <td>11.020000</td>\n",
       "      <td>10.710000</td>\n",
       "      <td>43049070</td>\n",
       "      <td>472438382.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.153179</td>\n",
       "      <td>1</td>\n",
       "      <td>2.894495</td>\n",
       "      <td>5.820451</td>\n",
       "      <td>0.760281</td>\n",
       "      <td>1.899833</td>\n",
       "      <td>3.113035</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-12-04</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>11.000000</td>\n",
       "      <td>11.080000</td>\n",
       "      <td>10.970000</td>\n",
       "      <td>11.080000</td>\n",
       "      <td>11.020000</td>\n",
       "      <td>20811293</td>\n",
       "      <td>229713745.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.074052</td>\n",
       "      <td>1</td>\n",
       "      <td>0.544460</td>\n",
       "      <td>5.852141</td>\n",
       "      <td>0.764420</td>\n",
       "      <td>1.910177</td>\n",
       "      <td>3.129985</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-12-05</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>10.990000</td>\n",
       "      <td>11.100000</td>\n",
       "      <td>10.960000</td>\n",
       "      <td>11.000000</td>\n",
       "      <td>11.080000</td>\n",
       "      <td>25491217</td>\n",
       "      <td>281189602.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.090704</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.722021</td>\n",
       "      <td>5.809888</td>\n",
       "      <td>0.758901</td>\n",
       "      <td>1.896385</td>\n",
       "      <td>3.107385</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-12-06</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>10.820000</td>\n",
       "      <td>10.930000</td>\n",
       "      <td>10.820000</td>\n",
       "      <td>10.900000</td>\n",
       "      <td>11.000000</td>\n",
       "      <td>23597997</td>\n",
       "      <td>256533148.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.083967</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.909094</td>\n",
       "      <td>5.757070</td>\n",
       "      <td>0.752002</td>\n",
       "      <td>1.879146</td>\n",
       "      <td>3.079136</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-12-07</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>10.940000</td>\n",
       "      <td>11.030000</td>\n",
       "      <td>10.880000</td>\n",
       "      <td>10.890000</td>\n",
       "      <td>10.900000</td>\n",
       "      <td>10580550</td>\n",
       "      <td>115760323.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.037648</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.091736</td>\n",
       "      <td>5.751789</td>\n",
       "      <td>0.751312</td>\n",
       "      <td>1.877422</td>\n",
       "      <td>3.076312</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>245 rows × 17 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                 code       open       high        low      close   preclose  \\\n",
       "date                                                                           \n",
       "2017-12-07  sh.600000  12.814685  12.893850  12.775103  12.824581  12.824581   \n",
       "2017-12-08  sh.600000  12.844372  12.854267  12.735521  12.794894  12.824581   \n",
       "2017-12-11  sh.600000  12.784999  12.903745  12.715730  12.834476  12.794894   \n",
       "2017-12-12  sh.600000  12.834476  12.834476  12.606880  12.616775  12.834476   \n",
       "2017-12-13  sh.600000  12.666253  12.676148  12.498029  12.606880  12.616775   \n",
       "...               ...        ...        ...        ...        ...        ...   \n",
       "2018-12-03  sh.600000  10.990000  11.050000  10.840000  11.020000  10.710000   \n",
       "2018-12-04  sh.600000  11.000000  11.080000  10.970000  11.080000  11.020000   \n",
       "2018-12-05  sh.600000  10.990000  11.100000  10.960000  11.000000  11.080000   \n",
       "2018-12-06  sh.600000  10.820000  10.930000  10.820000  10.900000  11.000000   \n",
       "2018-12-07  sh.600000  10.940000  11.030000  10.880000  10.890000  10.900000   \n",
       "\n",
       "              volume       amount  adjustflag      turn  tradestatus  \\\n",
       "date                                                                   \n",
       "2017-12-07  34802229  451233524.0           2  0.123835            1   \n",
       "2017-12-08  31296221  404411517.0           2  0.111360            1   \n",
       "2017-12-11  36649902  474566888.0           2  0.130409            1   \n",
       "2017-12-12  30370097  390113096.0           2  0.108064            1   \n",
       "2017-12-13  19345338  246331123.0           2  0.068835            1   \n",
       "...              ...          ...         ...       ...          ...   \n",
       "2018-12-03  43049070  472438382.0           2  0.153179            1   \n",
       "2018-12-04  20811293  229713745.0           2  0.074052            1   \n",
       "2018-12-05  25491217  281189602.0           2  0.090704            1   \n",
       "2018-12-06  23597997  256533148.0           2  0.083967            1   \n",
       "2018-12-07  10580550  115760323.0           2  0.037648            1   \n",
       "\n",
       "              pctChg     peTTM     pbMRQ     psTTM  pcfNcfTTM  isST  \n",
       "date                                                                 \n",
       "2017-12-07  0.000000  7.004418  0.981842  2.310626  -2.043354     0  \n",
       "2017-12-08 -0.231479  6.988205  0.979569  2.305277  -2.038624     0  \n",
       "2017-12-11  0.309358  7.009823  0.982600  2.312409  -2.044930     0  \n",
       "2017-12-12 -1.696224  6.890921  0.965933  2.273185  -2.010244     0  \n",
       "2017-12-13 -0.078433  6.885516  0.965175  2.271402  -2.008667     0  \n",
       "...              ...       ...       ...       ...        ...   ...  \n",
       "2018-12-03  2.894495  5.820451  0.760281  1.899833   3.113035     0  \n",
       "2018-12-04  0.544460  5.852141  0.764420  1.910177   3.129985     0  \n",
       "2018-12-05 -0.722021  5.809888  0.758901  1.896385   3.107385     0  \n",
       "2018-12-06 -0.909094  5.757070  0.752002  1.879146   3.079136     0  \n",
       "2018-12-07 -0.091736  5.751789  0.751312  1.877422   3.076312     0  \n",
       "\n",
       "[245 rows x 17 columns]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>code</th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "      <th>preclose</th>\n",
       "      <th>volume</th>\n",
       "      <th>amount</th>\n",
       "      <th>adjustflag</th>\n",
       "      <th>turn</th>\n",
       "      <th>tradestatus</th>\n",
       "      <th>pctChg</th>\n",
       "      <th>peTTM</th>\n",
       "      <th>pbMRQ</th>\n",
       "      <th>psTTM</th>\n",
       "      <th>pcfNcfTTM</th>\n",
       "      <th>isST</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2017-12-11</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.784999</td>\n",
       "      <td>12.903745</td>\n",
       "      <td>12.715730</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.794894</td>\n",
       "      <td>36649902</td>\n",
       "      <td>474566888.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.130409</td>\n",
       "      <td>1</td>\n",
       "      <td>0.309358</td>\n",
       "      <td>7.009823</td>\n",
       "      <td>0.982600</td>\n",
       "      <td>2.312409</td>\n",
       "      <td>-2.044930</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-12</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.606880</td>\n",
       "      <td>12.616775</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>30370097</td>\n",
       "      <td>390113096.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.108064</td>\n",
       "      <td>1</td>\n",
       "      <td>-1.696224</td>\n",
       "      <td>6.890921</td>\n",
       "      <td>0.965933</td>\n",
       "      <td>2.273185</td>\n",
       "      <td>-2.010244</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-13</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.666253</td>\n",
       "      <td>12.676148</td>\n",
       "      <td>12.498029</td>\n",
       "      <td>12.606880</td>\n",
       "      <td>12.616775</td>\n",
       "      <td>19345338</td>\n",
       "      <td>246331123.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.068835</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.078433</td>\n",
       "      <td>6.885516</td>\n",
       "      <td>0.965175</td>\n",
       "      <td>2.271402</td>\n",
       "      <td>-2.008667</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-14</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.656357</td>\n",
       "      <td>12.656357</td>\n",
       "      <td>12.527716</td>\n",
       "      <td>12.557402</td>\n",
       "      <td>12.606880</td>\n",
       "      <td>16141678</td>\n",
       "      <td>205219487.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.057436</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.392466</td>\n",
       "      <td>6.858493</td>\n",
       "      <td>0.961387</td>\n",
       "      <td>2.262488</td>\n",
       "      <td>-2.000784</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-15</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.557402</td>\n",
       "      <td>12.596984</td>\n",
       "      <td>12.478238</td>\n",
       "      <td>12.488134</td>\n",
       "      <td>12.557402</td>\n",
       "      <td>16210108</td>\n",
       "      <td>205323767.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.057679</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.551613</td>\n",
       "      <td>6.820661</td>\n",
       "      <td>0.956084</td>\n",
       "      <td>2.250008</td>\n",
       "      <td>-1.989747</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-18</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.577193</td>\n",
       "      <td>12.577193</td>\n",
       "      <td>12.478238</td>\n",
       "      <td>12.517820</td>\n",
       "      <td>12.488134</td>\n",
       "      <td>13445648</td>\n",
       "      <td>170140035.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.047843</td>\n",
       "      <td>1</td>\n",
       "      <td>0.237716</td>\n",
       "      <td>6.836874</td>\n",
       "      <td>0.958357</td>\n",
       "      <td>2.255356</td>\n",
       "      <td>-1.994477</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-19</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.517820</td>\n",
       "      <td>12.626671</td>\n",
       "      <td>12.488134</td>\n",
       "      <td>12.616775</td>\n",
       "      <td>12.517820</td>\n",
       "      <td>18399603</td>\n",
       "      <td>233884666.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.065470</td>\n",
       "      <td>1</td>\n",
       "      <td>0.790517</td>\n",
       "      <td>6.890921</td>\n",
       "      <td>0.965933</td>\n",
       "      <td>2.273185</td>\n",
       "      <td>-2.010244</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-20</th>\n",
       "      <td>sh.600000</td>\n",
       "      <td>12.626671</td>\n",
       "      <td>12.626671</td>\n",
       "      <td>12.468343</td>\n",
       "      <td>12.596984</td>\n",
       "      <td>12.616775</td>\n",
       "      <td>26639844</td>\n",
       "      <td>337603451.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.094791</td>\n",
       "      <td>1</td>\n",
       "      <td>-0.156866</td>\n",
       "      <td>6.880112</td>\n",
       "      <td>0.964417</td>\n",
       "      <td>2.269619</td>\n",
       "      <td>-2.007090</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 code       open       high        low      close   preclose  \\\n",
       "date                                                                           \n",
       "2017-12-11  sh.600000  12.784999  12.903745  12.715730  12.834476  12.794894   \n",
       "2017-12-12  sh.600000  12.834476  12.834476  12.606880  12.616775  12.834476   \n",
       "2017-12-13  sh.600000  12.666253  12.676148  12.498029  12.606880  12.616775   \n",
       "2017-12-14  sh.600000  12.656357  12.656357  12.527716  12.557402  12.606880   \n",
       "2017-12-15  sh.600000  12.557402  12.596984  12.478238  12.488134  12.557402   \n",
       "2017-12-18  sh.600000  12.577193  12.577193  12.478238  12.517820  12.488134   \n",
       "2017-12-19  sh.600000  12.517820  12.626671  12.488134  12.616775  12.517820   \n",
       "2017-12-20  sh.600000  12.626671  12.626671  12.468343  12.596984  12.616775   \n",
       "\n",
       "              volume       amount  adjustflag      turn  tradestatus  \\\n",
       "date                                                                   \n",
       "2017-12-11  36649902  474566888.0           2  0.130409            1   \n",
       "2017-12-12  30370097  390113096.0           2  0.108064            1   \n",
       "2017-12-13  19345338  246331123.0           2  0.068835            1   \n",
       "2017-12-14  16141678  205219487.0           2  0.057436            1   \n",
       "2017-12-15  16210108  205323767.0           2  0.057679            1   \n",
       "2017-12-18  13445648  170140035.0           2  0.047843            1   \n",
       "2017-12-19  18399603  233884666.0           2  0.065470            1   \n",
       "2017-12-20  26639844  337603451.0           2  0.094791            1   \n",
       "\n",
       "              pctChg     peTTM     pbMRQ     psTTM  pcfNcfTTM  isST  \n",
       "date                                                                 \n",
       "2017-12-11  0.309358  7.009823  0.982600  2.312409  -2.044930     0  \n",
       "2017-12-12 -1.696224  6.890921  0.965933  2.273185  -2.010244     0  \n",
       "2017-12-13 -0.078433  6.885516  0.965175  2.271402  -2.008667     0  \n",
       "2017-12-14 -0.392466  6.858493  0.961387  2.262488  -2.000784     0  \n",
       "2017-12-15 -0.551613  6.820661  0.956084  2.250008  -1.989747     0  \n",
       "2017-12-18  0.237716  6.836874  0.958357  2.255356  -1.994477     0  \n",
       "2017-12-19  0.790517  6.890921  0.965933  2.273185  -2.010244     0  \n",
       "2017-12-20 -0.156866  6.880112  0.964417  2.269619  -2.007090     0  "
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1.loc['2017-12-11':'2017-12-20']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### (6) 使用 df.loc[] 标签定位方式，选取 df1 数据库中 open 至 close 间的所有列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2017-12-07</th>\n",
       "      <td>12.814685</td>\n",
       "      <td>12.893850</td>\n",
       "      <td>12.775103</td>\n",
       "      <td>12.824581</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-08</th>\n",
       "      <td>12.844372</td>\n",
       "      <td>12.854267</td>\n",
       "      <td>12.735521</td>\n",
       "      <td>12.794894</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-11</th>\n",
       "      <td>12.784999</td>\n",
       "      <td>12.903745</td>\n",
       "      <td>12.715730</td>\n",
       "      <td>12.834476</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-12</th>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.834476</td>\n",
       "      <td>12.606880</td>\n",
       "      <td>12.616775</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2017-12-13</th>\n",
       "      <td>12.666253</td>\n",
       "      <td>12.676148</td>\n",
       "      <td>12.498029</td>\n",
       "      <td>12.606880</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-12-03</th>\n",
       "      <td>10.990000</td>\n",
       "      <td>11.050000</td>\n",
       "      <td>10.840000</td>\n",
       "      <td>11.020000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-12-04</th>\n",
       "      <td>11.000000</td>\n",
       "      <td>11.080000</td>\n",
       "      <td>10.970000</td>\n",
       "      <td>11.080000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-12-05</th>\n",
       "      <td>10.990000</td>\n",
       "      <td>11.100000</td>\n",
       "      <td>10.960000</td>\n",
       "      <td>11.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-12-06</th>\n",
       "      <td>10.820000</td>\n",
       "      <td>10.930000</td>\n",
       "      <td>10.820000</td>\n",
       "      <td>10.900000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-12-07</th>\n",
       "      <td>10.940000</td>\n",
       "      <td>11.030000</td>\n",
       "      <td>10.880000</td>\n",
       "      <td>10.890000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>245 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                 open       high        low      close\n",
       "date                                                  \n",
       "2017-12-07  12.814685  12.893850  12.775103  12.824581\n",
       "2017-12-08  12.844372  12.854267  12.735521  12.794894\n",
       "2017-12-11  12.784999  12.903745  12.715730  12.834476\n",
       "2017-12-12  12.834476  12.834476  12.606880  12.616775\n",
       "2017-12-13  12.666253  12.676148  12.498029  12.606880\n",
       "...               ...        ...        ...        ...\n",
       "2018-12-03  10.990000  11.050000  10.840000  11.020000\n",
       "2018-12-04  11.000000  11.080000  10.970000  11.080000\n",
       "2018-12-05  10.990000  11.100000  10.960000  11.000000\n",
       "2018-12-06  10.820000  10.930000  10.820000  10.900000\n",
       "2018-12-07  10.940000  11.030000  10.880000  10.890000\n",
       "\n",
       "[245 rows x 4 columns]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1.loc[:,'open':'close']"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### (7) 使用 df.loc[] 标签定位方式，选取 df1 数据库中时间从 2018-07-01 至 2018-07-08，open 至 close 间的所有列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>low</th>\n",
       "      <th>close</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-07-02</th>\n",
       "      <td>9.450212</td>\n",
       "      <td>9.450212</td>\n",
       "      <td>9.133556</td>\n",
       "      <td>9.192929</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-07-03</th>\n",
       "      <td>9.192929</td>\n",
       "      <td>9.281988</td>\n",
       "      <td>9.103869</td>\n",
       "      <td>9.252302</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-07-04</th>\n",
       "      <td>9.242406</td>\n",
       "      <td>9.321570</td>\n",
       "      <td>9.183033</td>\n",
       "      <td>9.212720</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-07-05</th>\n",
       "      <td>9.163242</td>\n",
       "      <td>9.252302</td>\n",
       "      <td>9.123660</td>\n",
       "      <td>9.163242</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-07-06</th>\n",
       "      <td>9.212720</td>\n",
       "      <td>9.331466</td>\n",
       "      <td>9.074183</td>\n",
       "      <td>9.272093</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                open      high       low     close\n",
       "date                                              \n",
       "2018-07-02  9.450212  9.450212  9.133556  9.192929\n",
       "2018-07-03  9.192929  9.281988  9.103869  9.252302\n",
       "2018-07-04  9.242406  9.321570  9.183033  9.212720\n",
       "2018-07-05  9.163242  9.252302  9.123660  9.163242\n",
       "2018-07-06  9.212720  9.331466  9.074183  9.272093"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1.loc['2018-07-01':'2018-07-08','open':'close']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
